import vue from "@vitejs/plugin-vue";
import cesium from "vite-plugin-cesium";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { fileURLToPath, URL } from "node:url";
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
import { defineConfig, splitVendorChunkPlugin } from "vite";

export default defineConfig({
  base: "./",
  build: {
    outDir: "web",
    chunkSizeWarningLimit: 1000,
  },
  server: {
    open: "/",
    port: 3000,
  },
  resolve: {
    alias: {
      "@": fileURLToPath(new URL("./src", import.meta.url)),
    },
  },
  plugins: [
    vue(),
    cesium(),
    AutoImport({
      resolvers: [ElementPlusResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver()],
    }),
    splitVendorChunkPlugin(),
  ],
});
